package com.stox.navigator.ui.swing.action;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import com.stox.ioc.Container;
import com.stox.navigator.ui.swing.presenter.NavigatorViewPresenter;
import com.stox.navigator.ui.swing.view.NavigatorView;

public class NewNavigatorAction implements ActionListener {

	private NavigatorViewPresenter navigatorViewPresenter;
	private NavigatorView navigatorView;
	
	@Override
	public void actionPerformed(ActionEvent e) {
		if(navigatorViewPresenter == null){
			navigatorViewPresenter = Container.get(NavigatorViewPresenter.class);
		}
		if(navigatorView == null){
			navigatorView = Container.get(NavigatorView.class);
		}
		if(!navigatorView.isVisible()){
			navigatorViewPresenter.present(navigatorView);
		}
	}

}
